programming4us
           
 
 
Applications Server

Microsoft Dynamic AX 2009 : The Batch Framework (part 2) - Batch-Enabling a Class

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/8/2013 9:00:00 PM

3. Batch-Enabling a Class

Each batch task is a batch-enabled class, and a class must be enabled for batch processing before it can be scheduled for execution as a batch task. The classes used for batch tasks are designated to run on either the client or the server. Tasks that run on the server can run automatically as part of a batch job, regardless of whether a client is open. Tasks that run on the client, however, must be run manually via the Batch processing form, which is in the Dynamics AX basic module, at Periodic\Batch\Processing.

Many classes included with Dynamics AX 2009 are already enabled for batch processing. You can also design a class that you create for execution within the Batch framework, as shown in the following example.

To allow your class to run as a batch task, you have to extend it from the RunBaseBatch class.

public class ExampleBatchTask extends RunBaseBatch


The RunBaseBatch class itself is an extension of the RunBase framework, so your batch class must adhere to the patterns and guidelines of the RunBase-extended classes.

To convert a class so that it’s batchable, you need to use the pack-unpack pattern and implement the methods pack and unpack to allow a class to be serialized. When a batch task gets created, its member variables are saved in a container using the pack method and stored in the Batch table. Later, when the batch server picks up the task for execution, it restores class member variables from the container using the unpack method, so it’s important to provide a correct list of variables necessary for class execution. If any member variable isn’t packable, the class can’t be packed and reinstantiated to the same state.

Following is an example of the pack and unpack methods.

public container pack()
{
    return [#CurrentVersion,#CurrentList];
}

public boolean unpack(container packedClass)
{
    Version version     = RunBase::getVersion(packedClass);
    switch (version)
    {
        case #CurrentVersion:
            [version,#CurrentList] = packedClass;
            break;
        default:
            return false;
    }
    return true;
}


The macros #CurrentList and #CurrentVersion referenced in the preceding code must be defined in the class declaration. #CurrentList is a macro holding a list of the class member variables to pack, as shown here.

   #define.CurrentVersion(1)
   #localmacro.CurrentList
        methodVariable1,
    methodVariable2
   #endmacro


You must implement the core logic of your batch class in the run method. If your batch class is designed to be executed on the server, there are some limitations on the operations you can use in the run method. For example, you can’t call any client logic or dialogs. However, you can still use Infolog classes—all Infolog and exception error messages are captured during batch class execution and stored in the Batch table.

You can also implement some RunBaseBatch-specific methods in your class to control its behavior as a batch task:

  • runsImpersonated Determines whether the batch task is run on the server or on a client. The base method always returns true, which means that the batch must run under the authority of the person who scheduled the batch and that no client session is involved.

    Note

    You can also verify whether a batch task runs on an AOS or client by selecting the Run Location field in the Batch Tasks form. It’s a good idea to write your batch job to be executed on a server to take advantage of the Dynamics AX 2009 batch features for servers.


  • canGoBatchJournal Determines whether the batch task class appears in the list of available classes when you create a new batch task using the Batch task form. 

Other -----------------
- Using Non-Windows Systems to Access Exchange Server 2007 : Terminal Server Client for Mac
- Using Non-Windows Systems to Access Exchange Server 2007 : Configuring and Implementing Entourage for the Mac
- Microsoft Lync Server 2010 : Planning for Deploying External Services - High Availability
- Microsoft Lync Server 2010 : Planning for Deploying External Services - Firewall Configuration (part 2)
- Microsoft Lync Server 2010 : Planning for Deploying External Services - Firewall Configuration (part 1)
- Microsoft Lync Server 2010 : Planning for Deploying External Services - Edge Server Considerations
- Microsoft Dynamic GP 2010 : Receivables Management (part 4) - Sales e-mail settings, Customers
- Microsoft Dynamic GP 2010 : Receivables Management (part 3) - Customer classes
- Microsoft Dynamic GP 2010 : Receivables Management (part 2) - Receivables Setup Options, Sales Territories, Salespeople
- Microsoft Dynamic GP 2010 : Receivables Management (part 1) - Receivables Management Setup
- Microsoft Dynamic GP 2010 : Payables Management (part 3) - Purchasing E-mail setup, Vendors
- Microsoft Dynamic GP 2010 : Payables Management (part 2) - Payables Setup Options, Vendor classes
- Microsoft Dynamic GP 2010 : Payables Management (part 1) - Payables Management Setup
- Microsoft Dynamic GP 2010 : Bank Reconciliation
- Microsoft Dynamic GP 2010 : General Ledger
- Using Non-Windows Systems to Access Exchange Server 2007 : Mac OS X Mail
- Using Non-Windows Systems to Access Exchange Server 2007 : Outlook Express
- Using Non-Windows Systems to Access Exchange Server 2007 : Understanding Non-Windows–Based Mail Client Options
- Microsoft Dynamics AX 2009 : The Application Integration Framework (part 8) - Consuming Web Services from Dynamics AX
- Microsoft Dynamics AX 2009 : The Application Integration Framework (part 7) - Sending One-Way Requests from Dynamics AX
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us